//
//  LGPatientAttendEvaluateCell.m
//  HeartDiseaseManage
//
//  Created by 1234 on 2023/5/24.
//  评估

#import "LGPatientAttendEvaluateCell.h"

@interface LGPatientAttendEvaluateCell()
/**   */
@property (nonatomic , strong)UIView *baseView;
/**   */
@property (nonatomic , strong)UIView *shadowView;
/**   */
@property (nonatomic , strong)UIImageView *coverView;
/**   */
@property (nonatomic , strong)UILabel *titleLabel;
/**   */
@property (nonatomic , strong)UILabel *scoreLabel;
/**   */
@property (nonatomic , strong)UILabel *unitLabel;
/**   */
@property (nonatomic , strong)UILabel *timeLabel;

@end

@implementation LGPatientAttendEvaluateCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubView];
    }
    return  self;
}

-(void)setDataDic:(NSDictionary *)dataDic{
    _dataDic = dataDic;
    [self.coverView sd_setImageWithURL:[NSURL URLWithString:dataDic[@"coveurl"]]];
    self.titleLabel.text = dataDic[@"title"];
    self.scoreLabel.text = dataDic[@"score"];
    self.timeLabel.text = [NSString stringWithFormat:@"评估完成时间：%@",dataDic[@"evatime"]];
}

#pragma mark
#pragma mark ====> 创建控件
-(void)createSubView{
    self.clipsToBounds = YES;
    self.contentView.backgroundColor = [UIColor colorWithString:@"#F9F9F9"];
    [self.contentView addSubview:self.baseView];
    [self.contentView addSubview:self.shadowView];
    [self.shadowView addSubview:self.coverView];
    [self.shadowView addSubview:self.titleLabel];
    [self.shadowView addSubview:self.scoreLabel];
    [self.shadowView addSubview:self.unitLabel];
    [self.shadowView addSubview:self.timeLabel];
    [self.baseView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.bottom.equalTo(self.contentView).offset(viewPix(16));
        make.top.right.equalTo(self.contentView).offset(-viewPix(16));
    }];
    [self.shadowView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(viewPix(28));
        make.right.equalTo(self.contentView).offset(-viewPix(28));
        make.top.equalTo(self.contentView).offset(viewPix(8));
        make.bottom.equalTo(self.contentView).offset(-viewPix(8));
        make.height.equalTo(@(viewPix(123)));
    }];
    [self.coverView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.equalTo(self.shadowView).offset(viewPix(12));
        make.width.height.equalTo(@(viewPix(64)));
    }];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.coverView.mas_right).offset(viewPix(10));
        make.right.equalTo(self.shadowView).offset(-viewPix(10));
        make.top.equalTo(self.shadowView).offset(viewPix(17));
    }];
    [self.scoreLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.titleLabel.mas_bottom).offset(viewPix(8));
        make.left.equalTo(self.titleLabel);
    }];
    [self.unitLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.scoreLabel.mas_right);
        make.bottom.equalTo(self.scoreLabel);
    }];
    [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.coverView.mas_bottom).offset(viewPix(13));
        make.left.equalTo(self.coverView);
        make.right.equalTo(self.shadowView).offset(-viewPix(10));
    }];
}

-(UIView *)baseView{
    if(!_baseView){
        _baseView = [UIView shadowViewWithColor:@"#B3C5D9" offset:CGSizeMake(0, 2) opacity:0.15 radius:10];
        _baseView.backgroundColor = [UIColor whiteColor];
    }
    return _baseView;
}

-(UIView *)shadowView{
    if(!_shadowView){
        _shadowView = [[UIView alloc] init];
        _shadowView.backgroundColor = [UIColor colorWithString:@"#FAFBFD"];
    }
    return _shadowView;
}

-(UIImageView *)coverView{
    if(!_coverView){
        _coverView = [[UIImageView alloc]init];
        _coverView.backgroundColor = [UIColor colorWithString:@"#E9F2FF"];
        _coverView.cornerRidus = 5;
    }
    return _coverView;
}

-(UILabel *)titleLabel{
    if(!_titleLabel){
        _titleLabel = [UILabel lableWithText:@"" colorString:@"#333333" textFont:LGFont(16) textAlignment:NSTextAlignmentLeft lines:1];
    }
    return _titleLabel;
}

-(UILabel *)scoreLabel{
    if(!_scoreLabel){
        _scoreLabel = [UILabel lableWithText:@"" colorString:@"#5DC3A1" textFont:LGFontWeight(20, UIFontWeightMedium) textAlignment:NSTextAlignmentLeft lines:1];
    }
    return _scoreLabel;
}

-(UILabel *)unitLabel{
    if(!_unitLabel){
        _unitLabel = [UILabel lableWithText:@"分" colorString:@"#666666" textFont:LGFont(14) textAlignment:NSTextAlignmentLeft lines:1];
    }
    return _unitLabel;
}

-(UILabel *)timeLabel{
    if(!_timeLabel){
        _timeLabel = [UILabel lableWithText:@"评估完成时间：" colorString:@"#666666" textFont:LGFont(16) textAlignment:NSTextAlignmentLeft lines:1];
    }
    return _timeLabel;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
